﻿using MobiSms.Infrastructure;
using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using MobiSms.Enums;

namespace MobiSms.DataModel
{
    [Table(Name = "T_Replies")]
    public class ReplyInfo : NotificationObject
    {
        #region Fields
        private string _guid = System.Guid.NewGuid().ToString();
        private string _serial;
        private string _content;
        private string _mobile;
        private ReplyMessageStatusValue _status = ReplyMessageStatusValue.Unread;
        private DateTime _time;
        private string _extension;
        #endregion

        #region Properties
        [Column(IsPrimaryKey = true)]
        public string Guid
        {
            get { return _guid; }
            set
            {
                _guid = value;
                RaisePropertyChanged(() => Guid);
            }
        }

        [Column]
        public string Serial
        {
            get { return _serial; }
            set
            {
                _serial = value;
                RaisePropertyChanged(() => Serial);
            }
        }

        [Column]
        public string Content
        {
            get { return _content; }
            set
            {
                _content = value;
                RaisePropertyChanged(() => Content);
                RaisePropertyChanged(() => DisplayContent);
            }
        }

        public string DisplayContent
        {
            get { return Content.Length > 35 ? Content.Substring(0, 35) + "..." : Content; }
        }

        [Column]
        public string Mobile
        {
            get { return _mobile; }
            set
            {
                _mobile = value;
                RaisePropertyChanged(() => Mobile);
            }
        }

        [Column]
        public ReplyMessageStatusValue Status
        {
            get { return _status; }
            set
            {
                _status = value;
                RaisePropertyChanged(() => Status);
            }
        }

        [Column]
        public DateTime Time
        {
            get { return _time; }
            set
            {
                _time = value;
                RaisePropertyChanged(() => Time);
            }
        }

        [Column]
        public string Extension
        {
            get { return _extension; }
            set
            {
                _extension = value;
                RaisePropertyChanged(() => Extension);
            }
        }
        #endregion
    }
}
